/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aeducommon;

import java.io.Serializable;

/**
 *
 * @author Adrian Hostettler
 */
public class GameModel implements Serializable{

    MainCardDeck mainCardDeck;
    FieldCardDeck[] cardDeck;
    Player[] players;
    int actualPlayerIndex;

    public GameModel() {
        this.mainCardDeck = new MainCardDeck();
        this.cardDeck = new FieldCardDeck[4];
        this.cardDeck[0] = new FieldCardDeck();
        this.cardDeck[1] = new FieldCardDeck();
        this.cardDeck[2] = new FieldCardDeck();
        this.cardDeck[3] = new FieldCardDeck();
        this.players = new Player[4];
        this.actualPlayerIndex = 0;
    }

    public int getActualPlayerIndex() {
        return actualPlayerIndex;
    }

    public void setActualPlayerIndex(int actualPlayerIndex) {
        this.actualPlayerIndex = actualPlayerIndex;
    }

    public void setNextPlayer() {
        if (actualPlayerIndex == 3) {
            actualPlayerIndex = 0;
        } else {
            actualPlayerIndex++;
        }
    }

    public FieldCardDeck[] getCardDeck() {
        return cardDeck;
    }

    public void setCardDeck(FieldCardDeck[] cardDeck) {
        this.cardDeck = cardDeck;
    }

    public MainCardDeck getMainCardDeck() {
        return mainCardDeck;
    }

    public void setMainCardDeck(MainCardDeck mainCardDeck) {
        this.mainCardDeck = mainCardDeck;
    }

    public Player[] getAllPlayers() {
        return players;
    }

    public void addPlayer(Player player) {
        this.players[player.getId()] = player;
    }

    public Player getPlayer(int index) {
        return this.players[index];
    }
}
